﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using Macad.Presentation;

namespace SpCad
{
    internal class SpCadControlViewModel : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler? PropertyChanged;
        string _UpdateMessage;

        #region Properties

        public string UpdateMessage
        {
            get { return _UpdateMessage; }
            private set
            {
                if (_UpdateMessage != value)
                {
                    _UpdateMessage = value;
                    RaisePropertyChanged();
                }
            }
        }
        public SpCadControlViewModel()
        {
            UpdateCommand = new RelayCommand(_UpdateExecute);
            DismissUpdateCommand = new RelayCommand(_DismissUpdateExecute);


        }
        ~SpCadControlViewModel()
        {

        }
        #region Update Info



        //--------------------------------------------------------------------------------------------------

        public RelayCommand UpdateCommand { get; }
        public RelayCommand DismissUpdateCommand { get; }

        //--------------------------------------------------------------------------------------------------

        void _UpdateExecute()
        {
            _DismissUpdateExecute();


        }

        //--------------------------------------------------------------------------------------------------

        void _DismissUpdateExecute()
        {
            UpdateMessage = "";

        }

        //--------------------------------------------------------------------------------------------------

        #endregion

        #region INotifyPropertyChanged

     

        protected virtual void RaisePropertyChanged([CallerMemberName] String propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }

        internal bool GlobalKeyDown(KeyEventArgs e)
        {
            //TODO  键盘事件,暂时不知道干什么的
            return true;
        }

        //--------------------------------------------------------------------------------------------------

        #endregion
        //--------------------------------------------------------------------------------------------------

        #endregion
    }
}
